
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class MyFileReader {
    private ArrayList<String> al;
    private int position;

    public MyFileReader( String fileName ) {
        
        String str;
	position = 0;
        al = new ArrayList<String>();

        try {    
	    BufferedReader in = new BufferedReader( new FileReader( fileName ) );
	    while( (str = in.readLine() ) != null )
		al.add(str);

	    in.close();
	}
        catch( IOException e ) {
	    System.out.println( e );
	}

    }

    public boolean hasNext() {
	return ( position < al.size() );
    }

    public String getNext() {
	String str = null;
	if( hasNext() )
	    str = al.get( position++ );
	return ( str );
    }
}